#include "HeatNetAlarmWgt.h"
#include <QPainter>
#include <QPalette>
#include <QFont>

HeatNetAlarmWgt::HeatNetAlarmWgt(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	QPalette pe;
	pe.setColor(QPalette::WindowText, Qt::red);
	ui.label->setPalette(pe);
	ui.label_2->setPalette(pe);

    QFont font(tr("ALARM_FONT"), 20, 100);
	ui.label->setFont(font);
	ui.label_2->setFont(font);

}

HeatNetAlarmWgt::~HeatNetAlarmWgt()
{}

void HeatNetAlarmWgt::UpdateAlarmInfo(QString strAlarmInfo, QString strAlarmTime)
{
	ui.label->setText(strAlarmInfo);
	ui.label_2->setText(strAlarmTime);
}

void HeatNetAlarmWgt::ClearAlarmInfo()
{
	ui.label->setText(tr("No alarm"));
	ui.label_2->setText(tr(""));
}

void HeatNetAlarmWgt::paintEvent(QPaintEvent * event)
{
	QPainter painter(this);
	painter.drawPixmap(rect(), QPixmap(":/HeatNetAssistClient/res/alarm.png"), QRect());
}
